package com.canbot.u05.socket;

import com.alibaba.fastjson.JSON;
import com.canbot.u05.control.RobotMgr;
import com.canbot.u05.utils.Logger;

/**
 * 平板发送消息给3288
 *
 * @author xiaowei
 */
public class MsgSendUtils {

        public static final String TAG = "MsgSendUtils";

        /**
         * 发送String类型的数据(socket发送)到头部.
         *
         * @param msgType
         * @param msgData
         */
        public static boolean sendStringMsg(int msgType, String msgData) {
                Logger.i(TAG, "msgData --" + msgData);
                StringMsgBean bean = new StringMsgBean();
                bean.setMsgType(msgType);
                bean.setMsgData(msgData);
                String sendBuf = JSON.toJSONString(bean);
                return HeadSocketManager.getInstance().sendStringMsgToServer(sendBuf);
        }

        /**
         * 通过socket和fpga通信,发送String数据给胸口pad
         *
         * @param msgType
         * @param msgData
         */
        public static boolean sendStringMsgToPad(int msgType, String msgData) {
                Logger.d(TAG, "msgData --" + msgData);
                return RobotMgr.getInstance().sendTouChuan(msgType, msgData);
        }

        /**
         * 发送String类型的数据(socket发送)到胸口.
         *
         * @param msgType
         * @param msgData
         */
        public static void sendStringMsgToPad2(int msgType, String msgData) {
                Logger.i(TAG, "msgData --" + msgData);
                StringMsgBean bean = new StringMsgBean();
                bean.setMsgType(msgType);
                bean.setMsgData(msgData);
                ChestSocketManager.getInstance().sendStringMsgToServer(bean);
        }

}
